<%@ page import="com.study.springmvc.model.Student" %>
<%@ page import="java.util.List" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>hello world 2</title>
</head>
<body>
${result != null ? result : "登陆成功，请添加用户"}
<p><a href="/toAdd">添加</a></p>
<table border="1">
    <tr>
        <td>ID</td>
        <td>创建时间</td>
        <td>修改时间</td>
        <td>学生Gid</td>
        <td>姓名</td>
        <td>操作</td>
    </tr>
    <%--
        List<Student> studentList = (List<Student>) request.getAttribute("studentList");
        for(Student student : studentList) {
    <tr>
        <td><%=student.getId()%></td>
        <td><%=student.getCreateTime()%></td>
        <td><%=student.getUpdateTime()%></td>
        <td><%=student.getStuGid()%></td>
        <td><%=student.getUserName()%></td>
        <td><a href="/update">修改</a>&nbsp;&nbsp;<a href="/delete">删除</a></td>
    </tr>
    <%}%>
    --%>
    <c:forEach items="${studentList}" var="stu" varStatus="stuStatus">
    <tr ${stuStatus.index % 2 == 0 ? "style=\"background-color: darkgray\"" : ""}>
        <td>${stu.id}</td>
        <td>${stu.createTime}</td>
        <td>${stu.updateTime}</td>
        <td>${stu.stuGid}</td>
        <td>${stu.userName}</td>
        <td><a href="/toUpdate?stuGid=${stu.stuGid}">修改</a>&nbsp;&nbsp;<a href="/delete?stuGid=${stu.stuGid}">删除</a></td>
    </tr>
    </c:forEach>
    <p>
        总记录数：${studentCount}
    <c:forEach begin="1" end="${pageCount}" step="1" varStatus="pageStatus">
        <a href="/list?pageIndex=${pageStatus.current}&pageSize=${pageSize}">${pageStatus.current}</a>
    </c:forEach>
    <p></p>
</table>
</body>
</html>